<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择用户</title>
<link rel="stylesheet" type="text/css"
	href="/bsc/static/common/bootstrap/css/bootstrap.min.css" />
<script src="/bsc/static/js/jquery-3.1.1.js" type="text/javascript"
	charset="utf-8"></script> 
<script
	src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"
	type="text/javascript" charset="utf-8"></script>
<script 
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table.min.js"
	type="text/javascript" charset="utf-8"></script>
<script
	src="/bsc/static/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js"
	type="text/javascript" charset="utf-8"></script> 
<link rel="stylesheet" type="text/css"
	href="../static/common/global.css" media="all">
 <link rel="stylesheet" type="text/css" href="../static/css/personal.css"
	media="all">
	<link rel="stylesheet" type="text/css"
	href="/bsc/static/common/layui/css/layui.css" media="all">
</head>
  <script type="text/javascript">
  $(document).ready(function() {
	  $("#all").click(function() {
	        var state = $("#all").prop("checked");
	        if(state == true) {
	            $("[name='option']").prop("checked", "checked");
	        } else {
	            $("[name='option']").prop("checked", "");
	        }
	    });
	    /*------------------------------------------------------------------------------------*/
	    /*根据复选框是否全部选中来判断全选框是否选中*/
	    //获取当前页面数据条数
	    var options = $("[name='option']");
	    //给每一个复选框加上click事件
	    $("input[name='option']").click(function() {
	        //获取当前选中的复选框个数
	        var i = $("input[name='option']:checked");
	        //判断复选框选中个数是否等于当前页面数据条数
	        if(i.length == options.length) { //如果两者值相等那么全选按钮也会选中
	            $("#all").prop("checked", "checked");
	        } else { //当两者值不相等时全选框便不会显示选中
	            $("#all").prop("checked", "");
	        }
	    });
	  
  $("#btn").click(function() {//绑定
		document.forms[0].action = "/bsc/biswechat/back";
		document.forms[0].submit();

	});
  $("#btn2").click(function() {//绑定
		document.forms[0].action = "/bsc/biswechat/list2";
		document.forms[0].submit();

	});
  $("#save").click(function() {//绑定
		var custom_user_id1='';	
		var array=[];
		$.each($('input:checkbox:checked'),function(){
			var a=$(this).val();
			if($(this).val()!="on"){
				array.push(a);
			}
		});
		custom_user_id1=array.join(',');
		 if(custom_user_id1!=''){
			 document.forms[0].action = "/bsc/biswechat/add?custom_user_id1="+ custom_user_id1;
			 document.forms[0].submit(); 
		 }else{
			 alert("未选择发送用户！")
		 } 
	});
  });
  </script>
</head>
<body>
<section class="layui-larry-box">
<blockquote class="layui-elem-quote news_search">
<form class="form-inline"  action="" method="post" onsubmit="return check()">
<table>
<tr>
<td>
	<div class="form-group">
	手机:<input type="text" name="mobile" class="form-control" style="width: 160px; height: 33px;">
	</div>
	<div class="form-group">
	姓名：<input type="text" name="username" class="form-control" style="width: 160px; height: 33px;">
	</div>
	<button type="button" class="btn btn-info glyphicon glyphicon-search " id="btn2" value="查询">查询</button>
	<button type="reset" class="btn btn-danger glyphicon glyphicon-refresh " value="重置">重置</button>
</td>
</tr>
</table>
</blockquote>
<table width="50%" >
</table>
<table class="table table-hover table-bordered" width="100%">
<tr class="active">
<td colspan="7">
<input type="button" id="save" value="选择发送用户" class="btn btn-primary" style="height: 35px;">
</td>
</tr>
<tr class="active">
<td class="text-center"><input type="checkbox" id="all">全选</td>
<td class="text-center">会员号</td>
<td class="text-center">手机</td>
<td class="text-center">姓名</td>
<td class="text-center">昵称</td>
<td class="text-center">性别</td>
<td class="text-center">openid</td>
</tr>
<c:forEach items="${list }" var="list">
<tr>
<td class="text-center"><input type="checkbox" name="option" value="${list.custom_user_id }" ></td>
<td class="text-center">${list.custom_user_id }</td>
<td class="text-center"> ${list.mobile }</td>
<td class="text-center">${list.username }</td>
<td class="text-center">${list.nikename }</td>
<td class="text-center"><c:if test="${list.sex=='0' }">保密</c:if><c:if test="${list.sex=='1' }">女</c:if><c:if test="${list.sex=='2' }">男</c:if> </td>
<td class="text-center">${list.openid }</td>
</tr>
</c:forEach>
</table>
<center>
<button type="button" class="btn btn-danger glyphicon glyphicon-remove" id="btn" style="height: 35px;">关闭</button>
</center>
</form>
</section>
</body>
</html>